# Makefile for Network module

UNAME := $(shell uname)

all: Network.o NetworkServer.o NetworkClient.o libnetwork

Network.o:
	g++ -fPIC -Wall -c -g -O0 -o Network.o Network.cpp

NetworkServer.o
	g++ -fPIC -Wall -c -g -O0 -o NetworkServer.o NetworkServer.cpp

NetworkClient.o:
	g++ -fPIC -Wall -c -g -O0 -o NetworkClient.o NetworkClient.cpp

libnetwork:
ifeq ($(UNAME), Linux)
# Linux
	g++ -shared -Wl,-soname,libnetwork.so.1 -o libnetwork.so.1.0.0 Network.o NetworkServer.o NetworkClient.o
	ln -s libnetwork.so.1.0.0 libnetwork.so.1
	ln -s libnetwork.so.1 libnetwork.so
else
ifeq ($(UNAME), Darwin)
# Mac OS X
	g++ -dynamiclib -o libnetwork.dylib Network.o NetworkServer.o NetworkClient.o
else
# Windows
	g++ -shared -o libnetwork.dll Network.o NetworkServer.o NetworkClient.o
endif
endif

clean:
	rm -vf *.o libnetwork.*